<template>
    <el-menu @select="select" :default-active="defaultActive" mode="horizontal" background-color="#333"
        style="padding:0 5rem" text-color="#fff" active-text-color="#ffd04b">
        <el-menu-item index="Home">
            <el-icon>
                <House />
            </el-icon>
            <span>首页</span>
        </el-menu-item>
        <el-menu-item index="BuyerList">
            <el-icon>
                <ShoppingTrolley />
            </el-icon>
            <span>买方商品</span>
        </el-menu-item>
        <el-menu-item index="SellerList">
            <el-icon>
                <ShoppingTrolley />
            </el-icon>
            <span>卖方商品</span>
        </el-menu-item>
        <el-menu-item index="Enterprise">
            <el-icon>
                <el-icon>
                    <EditPen />
                </el-icon>
            </el-icon>
            <span>企业注册</span>
        </el-menu-item>

        <el-menu-item index="OwnBuyer">
            <el-icon>
                <FolderOpened />
            </el-icon>
            <span>我的买方挂牌信息</span>
        </el-menu-item>
        <el-menu-item index="OwnSeller">
            <el-icon>
                <FolderOpened />
            </el-icon>
            <span>我的卖方挂牌信息</span>
        </el-menu-item>

        <el-menu-item index="Transaction">
            <el-icon>
                <Checked />
            </el-icon>
            <span>交易中心</span>
        </el-menu-item>

    </el-menu>
</template>

<script lang="ts" setup>
import {
    Document,
    Menu as IconMenu,
    Sunrise,
    ShoppingTrolley,
    FolderOpened,
    House,
    Location,
    Setting,
    Checked,
    EditPen
} from '@element-plus/icons-vue'
import { ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';

const route = useRoute()
const router = useRouter();
const defaultActive = ref(route.name);

watch(() => route.name, function () {
    defaultActive.value = route.name;
})
const select = (index, indexPath, item, routeResult) => {
    router.push({
        name: index
    })
}

</script>

<style lang="less" scoped>

</style>